package com.david.reader.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.david.reader.bean.BookBean
import com.david.reader.utils.BookHelper
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

class BookShellVm:ViewModel() {
    var bookListData:MutableLiveData<ArrayList<BookBean>> =  MutableLiveData<ArrayList<BookBean>>()

    fun getData(){
        CoroutineScope(Dispatchers.IO).launch {
            bookListData.postValue(BookHelper.instance.loadList())
        }
    }
}